package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.model.product.BaseCategory3;
import com.atguigu.gmall.model.product.BaseCategoryView;
import com.atguigu.gmall.product.mapper.BaseCategory3Mapper;
import com.atguigu.gmall.product.service.BaseCategory3Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 三级分类service层实现类
 */
@Service
public class BaseCategory3ServiceImpl implements BaseCategory3Service {

    @Autowired
    private BaseCategory3Mapper baseCategory3Mapper;

    /**
     * 根据二级分类id查询三级分类
     *
     * @param category2Id
     * @return
     */
    @Override
    public List<BaseCategory3> listByCategory2Id(Long category2Id) {
        return baseCategory3Mapper
                .selectList(new LambdaQueryWrapper<BaseCategory3>()
                        .eq(BaseCategory3::getCategory2Id, category2Id));
    }
}
